/* ====================================================================
 * (#)Header: CommandAction.java
 * (#)Revision: 
 * (#)Date Created: 2009-07-31
 * (#)Created By: Karol Wozniak
 * ====================================================================
 *
 * Copyright (c) 2007 karolak .  All rights reserved.
 *
 * ====================================================================
 * 
 * The software application represented here is the sole property of 
 * karolak. Its unauthorized utilization is expressly prohibited.
 * 
 * ====================================================================
 */
package com.karolak.web.saf.action;

import com.karolak.service.Service;
import com.karolak.web.saf.command.ActionCommand;

/**
 * <code>CommandAction</code> is ...
 * 
 * @author <a href="mailto:kwozniak@hotmail.com">Karol Wozniak</a>
 */
public abstract class CommandAction<T, Id, S extends Service<T, Id>> extends ModelAction<T, Id, S> {

	private static final long serialVersionUID = 1L;

	private ActionCommand command;

	public void prepare() {
		getCommand().prepare(this);
	}

	public void validate() {
		getCommand().validate(this);
	}

	public String execute() {
		return getCommand().execute(this);
	}

	// === get/set === //
	public ActionCommand getCommand() {
		return command;
	}

	public void setCommand(ActionCommand command) {
		this.command = command;
	}
}
